<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>
  <title>new (ZooomrResponse)</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
</head>
<body class="standalone-code">
  <pre><span class="ruby-comment cmt"># File Zooomr.Response.rb, line 15</span>
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">a_response</span>)
    
    <span class="ruby-ivar">@return_code</span>    = <span class="ruby-keyword kw">false</span>
    <span class="ruby-ivar">@error_message</span>  = <span class="ruby-value str">&quot;ok&quot;</span>
    <span class="ruby-ivar">@error_code</span>     = <span class="ruby-value str">&quot;0&quot;</span>
    
    <span class="ruby-keyword kw">if</span> (<span class="ruby-keyword kw">nil</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">a_response</span>)
      
      <span class="ruby-ivar">@error_message</span>  = <span class="ruby-value str">&quot;No response from Zooomr!&quot;</span>
      <span class="ruby-ivar">@json_response</span>  = <span class="ruby-constant">JSON</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-value str">&quot;{\&quot;stat\&quot;: \&quot;fail\&quot;, \&quot;code\&quot;: \&quot;98\&quot;, \&quot;message\&quot;: \&quot;No response from Zooomr\&quot; }&quot;</span>)
      
    <span class="ruby-keyword kw">else</span>
      
      <span class="ruby-ivar">@json_response</span>  = <span class="ruby-identifier">a_response</span>
      
      <span class="ruby-keyword kw">if</span> (<span class="ruby-value str">'ok'</span>.<span class="ruby-identifier">eql?</span>(<span class="ruby-identifier">a_response</span>[<span class="ruby-value str">'stat'</span>]))
        
        <span class="ruby-ivar">@return_code</span>    = <span class="ruby-keyword kw">true</span>
      
      <span class="ruby-keyword kw">else</span>

        <span class="ruby-ivar">@error_code</span>     = <span class="ruby-identifier">a_response</span>[<span class="ruby-value str">'code'</span>]
        <span class="ruby-ivar">@error_message</span>  = <span class="ruby-identifier">a_response</span>[<span class="ruby-value str">'message'</span>]
        
      <span class="ruby-keyword kw">end</span>
    <span class="ruby-keyword kw">end</span>
  <span class="ruby-keyword kw">end</span></pre>
</body>
</html>